using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Win : MonoBehaviour
{
     private bool isGameOver = false; 
    public GameObject winUI;

    private void OnTriggerEnter(Collider other)
    {
        if (!isGameOver && other.CompareTag("win"))
        {
            isGameOver = true; // 防止多次触发
            Time.timeScale = 0f; // 暂停游戏时间
            if (winUI != null)
            {
                winUI.SetActive(true); // 显示胜利UI
            }
            else
            {
                Debug.LogWarning("winUI 未赋值！");
            }
            Debug.Log("YOU WIN!");
        }
    }
}
